<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp_lib/init.jsp"%>

<script type="text/javascript">
	var add_form_panel = Ext.create("Ext.form.Panel", {
		url : "add.htm",
		buttonAlign : "center",
		bodyStyle : "padding: 5px;",
		defaultType : "textfield",
		items : [ {
			fieldLabel : "银行",
			name : "bank.name",
			xtype : "textfield",
			anchor : '100%',
			allowBlank : false
		}, {
			xtype : 'filefield',
			name : 'photo',
			fieldLabel : '文件',
			msgTarget : 'side',
			allowBlank : false,
			anchor : '100%',
			buttonText : '选择文件'
		}, {
			fieldLabel : "办卡超链接",
			name : "bank.url_bk",
			anchor : '100%',
			xtype : "textfield"
		}, {
			fieldLabel : "提升额度超链接",
			name : "bank.url_te",
			anchor : '100%',
			xtype : "textfield"
		}, {
			name : "bank.file_id",
			xtype : "textfield",
			hidden : true
		}],
		buttons : [ {
			text : "保存",
			formBind : true, //only enabled once the form is valid
			disabled : true,
			handler : function() {
				var form = this.up("form").getForm();
				if (form.isValid()) {
					form.submit({
						waitMsg : "保存中...",
						success : function(form, action) {
							Ext.Msg.alert("提示", action.result.tip.msg);
							add_form_panel_win.close();
							dataStore.load();
						},
						failure : function(form, action) {
							Ext.Msg.alert("提示", action.result.tip.msg);
						}
					});
				}
			}
		} ]
	});

	var add_form_panel_win = Ext.create("Ext.Window", {
		title : "银行添加",
		closeAction : "hide",
		width:500,
		items : add_form_panel
	});

	function myAdd() {
		add_form_panel.getForm().reset();
		add_form_panel_win.show();
	}
</script>
